<template>
	<view v-if="show" class="productShare">
		<view class="show-bg" @click="hideShare"></view>
		<view class="show-cont" :class="{'show': showCont==true}">
			<view class="img">
				<image :src="getImg()" mode=""></image>
			</view>
			<view class="bottom1" @click="shareQuick">
				<view class="b-item">
					<view>
						<image src="" mode=""></image>
					</view>
					<view>一键分享</view>
				</view>
				<view class="b-item" @click="save">
					<view>
						<image src="" mode=""></image>
					</view>
					<view>保存图片</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import Request from '../../../../common/request.js'
	import {
		api
	} from '../../../../common/api.js'
	export default {
		props: [
			'commodityId',
			'pictureId',
			'page'
		],
		data() {
			return {
				show: false,
				showCont: false
			};
		},
		methods: {
			getImg() {
				return api + '/wxShare/image?commodityId=6&pictureId=10&page=';
			},
			showShare() {
				uni.showToast({
						title: '正在生成图片',
						duration: 1000,
						icon:'loading'
				});
				this.show = true;
				let self = this;
				setTimeout(function() {
					self.showCont = true
				}, 1000)
			},
			hideShare() {
				this.show = false;
				this.showCont = false
			},
			shareQuick() {

			},
			/* 保存图片 */
			save(){
				uni.saveImageToPhotosAlbum({
						filePath: this.getImg(),
						success: (res) => {
							if (res.statusCode === 200) {
									uni.showToast({
											title: '保存成功',
											duration: 1000,
											icon:'success'
									});
							}
						}
				});
			},
		}
	}
</script>

<style>
	
</style>
